<%@page import="org.serc.pensieve.model.*"%>
<%@page import="java.util.ArrayList"%>
<%@page import="com.sun.org.apache.xalan.internal.xsltc.runtime.Parameter"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%
String loggedInUserName = (String)session.getAttribute("userName");

String loggedInUserPassword = (String)session.getAttribute("userPassword");

String loggedInUserRole = (String)session.getAttribute("userRole");
/*out.print(loggedInUserName);
out.print(loggedInUserPassword);
out.print(loggedInUserRole);*/

if(loggedInUserName == null || loggedInUserPassword == null || loggedInUserRole == null)
{
    response.sendRedirect("login1.jsp?error= Wrong Username or Password");
}
if(!(loggedInUserRole.equals("Inspector")))
{
response.sendRedirect("login1.jsp?error=You have Logged in as a "+loggedInUserRole+ "Role." );//If you want to access Inspector Role, you need to log out from "+loggedInUserRole+ "role and then log in again for Inspector
}


//Getting NewInspectionObj from session.
ArrayList<Inspection> tempInspection //= new  ArrayList<Inspection>();
//tempInspection
        = (ArrayList<Inspection>)session.getAttribute("NewInspectionObj");
//int sss = tempInspection.size();
//out.print((String)tempInspection.get(0).SRSID);
//out.print(tempInspection.get(0).checkListID);
//Inspection aas = new Inspection();

//aas =tempInspection.get(0);
//out.print(sss);
//out.print(tempInspection.get(0).inspectionID);
//out.print(tempInspection.get(0).inspectionName);
//out.print(tempInspection.get(0).inspectionNum);
%>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Yellow Effects by CMG Technologies</title>
<link href="yellow-effectz.css" rel="stylesheet" type="text/css" />

<script type="text/javascript">
var Global
function openwin(url, width, height ,srsId, checklistid) {
//alert(width+"  "+ height);

//alert(srsId);c
var name = "popup"; // popup name
var width = width; // popup width
var height = height; // popup height
var left = (screen.width - width) / 2 ;
var top = (screen.height - height) / 2;
var windowproperties = "width="+ width +",height="+ height +",left="+ left +",top="+ top +",scrollbars=1";
window.open(url, name, windowproperties);


	var xmlhttp;


if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari

//alert("Received");

xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5

    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{ //alert(xmlhttp.responseText);
    

//        document.getElementById('dd2').innerHTML = xmlhttp.responseText;newInspections
//document.getElementById("newInspections").innerHTML = xmlhttp.responseText;
//alert(xmlhttp.responseText);
//document.getElementById('qqq').innerHTML = xmlhttp.responseText;
//alert(xmlhttp.responseText);
}
}
// this function ser session and when simple/index page loads, it retrieves that session.
xmlhttp.open("GET","PreparationController?action=getUsecases&srsID="+srsId+"&checklistID="+checklistid,true);
xmlhttp.send();

/*var name = "popup"; // popup name
var width = width; // popup width
var height = height; // popup height
var left = (screen.width - width) / 2 ;
var top = (screen.height - height) / 2;
var windowproperties = "width="+ width +",height="+ height +",left="+ left +",top="+ top +",scrollbars=1";
window.open(url, name, windowproperties);
*/
}
//-----------------------------------
function hideshow(idd)
{
	
	if(document.getElementById(idd).style.display ==  "block")
	{
		 
		document.getElementById(idd).style.display = 'none';
	}
	else if(document.getElementById(idd).style.display == "none")
	{
 		document.getElementById(idd).style.display = 'block';
	}
	
	
	
}
//------------------------------
function LoadNewInspections()
{

        document.getElementById('pendingtaskContent').innerHTML = "<h3>Click any inspection to check its data...</h2>";
        //alert(1);
        document.getElementById('welcome').innerHTML = "No Inspection selected.";
	var xmlhttp;


if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari

//alert("Received");

xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5

    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
//        document.getElementById('dd2').innerHTML = xmlhttp.responseText;newInspections
document.getElementById("newInspections").innerHTML = xmlhttp.responseText;
//alert(xmlhttp.responseText);
}
}
xmlhttp.open("GET","PreparationController?action=newInspections",true);
xmlhttp.send();





    
}
//When click on any new inspections, this function will called and then load relevent data there,
function loadData(srsID,checkListId,inspectionId,inspectionNum,inspectionDescription,inspectionName)
{//srsID,checkListId,inspectionId,inspectionNum,inspectionDescription,inspectionName
//    alert(srsID+checkListId+inspectionId+inspectionNum+inspectionDescription+inspectionName);
document.getElementById('welcome').innerHTML = inspectionName;
document.getElementById('pendingtaskContent').innerHTML="<p id=\"projectDescription\" onclick=\"hideshow('hideshowDes')\" class=\"changeColor\">+Berief Description about inspection</p>";
            document.getElementById('pendingtaskContent').innerHTML+="  <div id=\"hideshowDes\" style=\"display:none;  color:#FFF\"><h3>Inspection Name</h3>"+inspectionName+"<h3>Description : </h3>"+inspectionDescription;
document.getElementById('pendingtaskContent').innerHTML+= "<br />";
               document.getElementById('pendingtaskContent').innerHTML+=" </div>";
              // document.getElementById('pendingtaskContent').innerHTML+="<p id=\"projectDescription\" onclick=\"hideshow('hideshowinfo')\" class=\"changeColor\">+Admin/Moderator Info</p>";
             //  document.getElementById('pendingtaskContent').innerHTML+="<div id=\"hideshowinfo\" style=\"display:none;color:#FFF\">tempd description sodis dlsjdsl dskdl dlsdj ldskjld lskdls dlskdl dlskjdl dlsdkjl dlsdklsd lsdksld lsdfkl lkdfldkfdl";
               //document.getElementById('pendingtaskContent').innerHTML+="</div>";
               document.getElementById('pendingtaskContent').innerHTML+="<p id=\"projectDescription\" onclick=\"openwin('Simple/index.jsp?insId="+inspectionId +"',1000,500,"+srsID+","+checkListId+")\" class=\"changeColor\" style=\"color:blue;\">Link to start this inspection</p>";
               document.getElementById('pendingtaskContent').innerHTML+="<div id=\"hideshowstart\" style=\"display:none; color:#FFF\">tempd description sodis dlsjdsl dskdl dlsdj ldskjld lskdls dlskdl dlskjdl dlsdkjl dlsdklsd lsdksld lsdfkl lkdfldkfdl";
               document.getElementById('pendingtaskContent').innerHTML+="</div>";
    
}//?srsID="+srsID+"&checkListID="+checkListId+"&inspectionID="+inspectionId+"&inspectionNum="+inspectionNum+"&inspectionName="+inspectionName+"&inspectionDescription="+inspectionDescription+
</script>
</head>

    <!--Calling this methode and useing ajax call then from server side saving the inspection object in session, and in response just write "data being loading" or any thing... this way populate the data here in this page.-->
<body onload="LoadNewInspections()">
<table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="50%" height="120"><table border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="42" valign="bottom"><a href="training.jsp" class="logo">Pensieve</a></td>
          </tr>
          <tr>
    <td><a href="training.jsp" class="tag">A SOftware Requirement Inspection Software</a></td>
          </tr>
        </table></td>
        <td valign="bottom" style="padding-bottom:8px;"><table width="60%" border="0" align="right" cellpadding="0" cellspacing="0">
          <tr>
            <td width="15"><img src="images/img04.gif" alt="Home" width="11" height="10" /></td>
            <td><a href="training.jsp" class="topmenu">Inspector Area</a></td>
            <td width="15">&nbsp;</td>
            <td>&nbsp;</td>
            <td width="15">&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="10"></td>
  </tr>
  <tr>
    <td height="40"><table width="70%" border="0" cellspacing="0" cellpadding="0">
      <tr>
       <!-- <td width="44%"><a href="TrainingHome.jsp" class="toplinks">Training phase Home</a></td>-->
        <td width="44%"><a href="Training.jsp" class="toplinks">Received  New Inspections</a></td>
        <td width="35%"><a href="pendingTasks.jsp" class="toplinks">Pending Inspections</a></td>
        <td width="14%"><a href="MainControler?action=Logout" class="toplinks">Log Out</a></td>
        <td width="1%">&nbsp;</td>
        <td width="6%">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="220" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td class="boxed" valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td class="boxtitle">Received Inspections</td>
              </tr>
              <tr>
                <td>&nbsp;</td>
              </tr>
              <tr>
             <td id="newInspections">
             <!-- <table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
                  <tr>
                    <td height="50"><a href="training.jsp" class="smallred">1)Received New Inspection 1</a></td>
                  </tr>
                  <tr>
                    <td class="date">&nbsp;</td>
                    </tr>
              <tr>
                <td height="50"><a href="training.jsp" class="smallred">2)Received New Inspection 2</a></td>
                  </tr>
              <tr>
                <td class="date">&nbsp;</td>
              </tr>
              <tr>
                <td height="50"><a href="training.jsp" class="smallred">3) Received New Inspection 3</a></td>
                
              </tr>
               <tr>
                <td height="50"><a href="training.jsp" class="smallred">4) Received New Inspection 4</a></td>
                
              </tr>
                </table>
             -->
             </td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td><a href="#" class="smallred"></a></td>
          </tr>
          <tr>
            
          </tr>
        </table></td>
        <td valign="top" style="padding-left:12px; text-align:justify; line-height:190%; padding-top:10px;">
            <h2 id="welcome" class="welcome">Received New Inspection 1</h2>
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td height="1" bgcolor="#CCCCCC">
              <br /><br /><br />
             
             <div id="pendingtaskContent">
                 <p id="projectDescription" onclick="hideshow('hideshowDes')" class="changeColor">+Berief Description about inspection</p>
              <div id="hideshowDes" style="display:none;  color:#FFF">tempd description sodis dlsjdsl dskdl dlsdj ldskjld lskdls dlskdl dlskjdl dlsdkjl dlsdklsd lsdksld lsdfkl lkdfldkfdl
              
              
              fdfdf<br />
                </div>
              <p id="projectDescription" onclick="hideshow('hideshowinfo')" class="changeColor">+Admin/Moderator Info</p>
              <div id="hideshowinfo" style="display:none;color:#FFF">tempd description sodis dlsjdsl dskdl dlsdj ldskjld lskdls dlskdl dlskjdl dlsdkjl dlsdklsd lsdksld lsdfkl lkdfldkfdl
              
              
              fdfdf</div>
              
              
                <p id="projectDescription" onclick="openwin('Simple/index.jsp',1000,500)" class="changeColor" style="color:blue;">Link to start this inspection</p>
              <div id="hideshowstart" style="display:none; color:#FFF">tempd description sodis dlsjdsl dskdl dlsdj ldskjld lskdls dlskdl dlskjdl dlsdkjl dlsdklsd lsdksld lsdfkl lkdfldkfdl
              
              
              fdfdf</div>
              </div>
              </td>
            </tr>
          </table>

</td>
      </tr>
    </table></td>
  </tr>
  <tr>
<td height="1" bgcolor="#CCCCCC"></td>
  </tr>
  <tr>
    <td align="center"><p id="legal">All Right Reserved &copy; 2011, Designed by FAST_Pensive</p></td>
  </tr>
</table>
</body>
</html>
